'use strict';

/**
 * @ngdoc function
 * @name jgappApp.controller:AttendanceAttendanceStatisticdetailCtrl
 * @description
 * # AttendanceAttendanceStatisticdetailCtrl
 * Controller of the jgappApp
 */
angular.module('jgappApp')
    .controller('AttendanceAttendanceStatisticdetailCtrl', function ($location, DataService, openApi, localStorageService) {
        var vm = this;
        var init = function () {
            vm.param = {};
            var attLog = localStorageService.get("attLog");
            vm.param.acId = attLog.value;
            vm.param.year = attLog.name;
            vm.param.month = attLog.text;
            DataService.getData(openApi.attendanceLog, vm.param).then(function (data) {
                vm.info = data;
            });
        };
        vm.map = [
            {
                value: 1,
                name: "正常天数",
                key: "normal"
            }, {
                value: 2,
                name: "迟到",
                key: "lateam"
            }, {
                value: 3,
                name: "早退",
                key: "earlypm"
            }, 
            // {
            //     value: 4,
            //     name: "未签到",
            //     key: "unsignam"
            // }, {
            //     value: 5,
            //     name: "未签退",
            //     key: "unsignpm"
            // }, 
            {
                value: 0,
                name: "范围外",
                key: "rangeoutside"
            }, {
                value: 4,
                name: "加班",
                key: "overtime"
            }];
        init();
        // 进入详情
        this.goDetail = function (value, type) {
            if (vm.info[value] > 0) {
                $location.path("attendance/attendance_log/" + type)
            }
        }
    });
